package com.neusoft.news.controller;

import java.io.IOException;
import java.util.List;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.neusoft.news.bean.News;
import com.neusoft.news.service.NewsExamineService;

@WebServlet("/examine")
public class ExamineServlet extends BaseServlet {
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;

	@Override
	protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
		// TODO Auto-generated method stub
		this.doPost(req, resp);
	}

	@Override
	protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
		// TODO Auto-generated method stub
		super.doPost(req, resp);
		NewsExamineService newsExamineService = new NewsExamineService();
		List<News> news = newsExamineService.selectAllNews();
		req.setAttribute("newsList", news);
		req.getRequestDispatcher("/WEB-INF/jsp/examine.jsp").forward(req, resp);
	}
}
